home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16093 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  59 lines

  1. Path: newsfeed.concentric.net!news
  2. From: mikolaj@concentric.net
  3. Newsgroups: comp.lang.c++
  4. Subject: Problems linking Turbo C++ with TASM
  5. Date: 9 Apr 1996 15:02:11 GMT
  6. Organization: Concentric Internet Services
  7. Message-ID: <4kdu5j$l2u@tribune.concentric.net>
  8. Reply-To: mikolaj@concentric.net
  9. NNTP-Posting-Host: cnc125038.concentric.net
  10. X-Newsreader: IBM NewsReader/2 v1.2.5
  11.  
  12. Hi. I have a problem linking a Turbo C++ program with a Turbo Assembler 
  13. module.  C++ program calls an assembler routine, which has to take a file name from C++ as an array ex: char filename[]="file.dat" , or 
  14. char *filename="file.dat".      This is the C++ program:
  15. Can somebody tell me what I am doing wrong? Please? Thanks mikE!
  16. #include <fstream.h>
  17. #include <conio.h>
  18. #include <stdlib.h>
  19. #include <ctype.h>
  20. fstream fp;
  21. extern "C" void asmroutine(char * filename);
  22. char * filename="file.dat";
  23. //or char filename[]="file.dat";
  24. void main()
  25. {
  26. asmroutine(filename);
  27. return;
  28. }
  29. this is the asm portion of code:
  30.     ideal
  31.     p386
  32.         model small
  33.     dataseg
  34. fhand    dw    ?
  35.     codeseg
  36.     public    _asmroutine
  37. PROC    _asmroutine  
  38.     arg filename:Word
  39.     push    bp
  40.     mov    bp,sp
  41.     mov    ax,@data
  42.     mov    ds,ax
  43.     mov    ax, 3D00H
  44.     lea    dx,[filename]
  45.     int    21H
  46.     jnc    continue
  47.     jmp    exit
  48. continue:    
  49.          ...code follows...
  50.      mov    ah, 3Eh
  51.     mov    bx, [fhand]
  52.     int    21h        ;close file
  53. exit:
  54.     pop    bp
  55.     ret
  56. endp    _asmroutine
  57. END
  58.                                      
  59.